package com.zhuoyue.biz.core.command.cmd.common.faa;

import com.zhuoyue.biz.core.api.domain.DeviceAndGatewayDO;
import com.zhuoyue.biz.core.api.dto.req.ControlReq;
import com.zhuoyue.biz.core.command.cmd.common.faa.base.ControlCmd;
import com.zhuoyue.biz.core.command.cmd.common.faa.base.SceneEnum;
import com.zhuoyue.common.constant.DataBase;

import static com.zhuoyue.common.constant.ControlType.Set.SCENE_SET_REQUEST;


/**
 * @author Administrator
 */
public class ScenePanel0Faa8A02 extends ControlCmd {
    private static String setRoad = null;

    /**
     * 场景配置
     *
     * @param deviceAndGatewayDO
     * @param controlReq         actions:{
     *                           sceneId:xxxxxxx
     *                           setRoad:1
     *                           }
     *                           controlType:"SCENE_SET_REQUEST"
     */
    public static String set(DeviceAndGatewayDO deviceAndGatewayDO, ControlReq controlReq, String code) {
        setRoad = (String) controlReq.getActions().get("setRoad");
        String cmd = "";
        switch (controlReq.getControlType()) {
            case SCENE_SET_REQUEST:
                //场景配置
                cmd = getControlCmd(deviceAndGatewayDO, sceneSet(code));
                break;
            default:
                break;
        }
        return cmd;
    }

    private static String sceneSet(String code) {
        return SceneEnum.getSceneEnumCmd(setRoad) + DataBase.DATA_LENGTH_01 + code;
    }
}
